[#macro pager pager url parameterMap = {} maxShowtotalPage = 4]
    [#if pager.totalCount > 0]

    <style>
        .rate-page .rate-paginator .currentPage{
            background-color:#ddd;
        }

        #PageNum {
            height: 28px;
            text-align: left;
            border: 1px solid #f1f1f1;
            padding: 0 10px;
            white-space: nowrap;
            text-align: center;

        }

        #PageNum li .sel {
            background-color: #eb6d48;
            color:white
        }

        #PageNum li {
            text-align: center;
            display: inline-block;
            padding: 0px 5px;
        }

        #PageNum li a {
            display: block;
            background-color: #FFF;
            height: 30px;
            line-height: 30px;
            vertical-align: middle;
            font-size: 12px;
            padding: 0px 10px;
            -moz-border-radius: 30px;
            -webkit-border-radius: 30px;
            border-radius: 30px;
            text-decoration: none;
            color: #333;
        }

        #PageNum li a:hover {
            background-color: #eb6d48;
            color: #FFF;
        }
    </style>
    <script type="text/javascript">
        var rsss = false;
        $(function() {



            if (Number($("[name='totalCount']").val()) > 0) {
                var pages = [], totalPage = Number($("[name='totalPage']").val()), totalCount = Number($(
                        "[name='totalCount']").val()), currentPage = Number($(
                        "[name='pageNum']").val()) == 0 ? 1 : Number($(
                        "[name='pageNum']").val());
                pages[pages.length] = ' <th colspan="100"><i>当前第' + currentPage + '页/共'
                        + totalPage + '页</i><i>共' + totalCount + '条记录</i>';

                // console.log(currentPage);
                if (currentPage == 1) {
                    pages[pages.length] = ' <li ><a class="done">首页</a></li>';
                } else {
                    pages[pages.length] = ' <li ><a class="first">首页</a></li>';
                }

                if (currentPage < 5) {
                    for (var i = 1; i <= (totalPage > 10 ? 10 : totalPage); i++) {
                        var c = "";
                        if (currentPage == i) {
                            c = "sel";
                        }
                        pages[pages.length] = '<li><a href="#" class=' + c + ' >' + i
                                + '</a></li>';

                    }
                } else if (currentPage >= totalPage - 5) {
                    for (var i = ((totalPage - 9) < 1 ? 1 : (totalPage - 9)); i <= totalPage; i++) {
                        var c = "";
                        if (currentPage == i) {
                            c = "sel";
                        }
                        pages[pages.length] = '<li><a href="#" class=' + c + ' >' + i
                                + '</a></li>';

                    }
                } else {
                    for (var i = currentPage - 4; i <= currentPage + 5; i++) {
                        var c = "";
                        if (currentPage == i) {
                            c = "sel";
                        }

                        pages[pages.length] = '<li><a href="#" class=' + c + ' >' + i
                                + '</a></li>';

                    }
                }

                if (currentPage < totalPage) {
                    pages[pages.length] = '<li ><a class="next">下一页</a></li><li ><a class="last">尾页</a></li>';
                } else {
                    pages[pages.length] = '<li ><a class="done">下一页</a></li><li ><a class="done">尾页</a></li>';
                }
                $("#PageNum").html(pages.join("")).find(
                        "a:not(.next,.prev,.first,.last,.done)").click(function() {
                    $("[name='currentPage']").val($(this).text());
                    $("#pagerForm").submit();
                });
                $("#PageNum").find("a.first").click(function() {
                    num = 1;
                    $("[name='currentPage']").val(num);
                    $("#pagerForm").submit();
                });
                $("#PageNum").find("a.prev").click(
                        function() {
                            num = Number($("[name='currentPage']").val()) - 1 < 0 ? 0
                                    : Number($("[name='currentPage']").val()) - 1;
                            $("[name='currentPage']").val(num);
                            $("#pagerForm").submit();
                        });
                $("#PageNum").find("a.next").click(
                        function() {
                            $("[name='currentPage']").val(
                                    Number($("[name='currentPage']").val()) + 1);
                            $("#pagerForm").submit();
                        });
                $("#PageNum").find("a.last").click(function() {
                    num = Number($("[name='totalPage']").val());
                    $("[name='currentPage']").val(num);
                    $("#pagerForm").submit();
                });
                $("#PageNum").find("input.btn_violet").click(function() {
                    num = Number($("[name='page']").val());
                    if (num > totalPage) {
                        num = totalPage;
                    } else if (num < 1) {
                        num = 1;
                    }
                    $("[name='currentPage']").val(num);
                    $("#pagerForm").submit();
                });

            }
            $("#query").click( function() {
                $("#searchForm").attr("action",$('#pagerForm').attr('action')).submit();
            });
        });

    </script>

    <ul id="PageNum">
    </ul>
    <form id="pagerForm" method="post" action="${url}">
        <input type="hidden" name="totalPage" value="${pager.totalPage}"/>
        <input type="hidden" name="totalCount" value="${pager.totalCount}"/>
        <input type="hidden" name="pageNum" value="${pager.currentPage}"/>
        <input type="hidden" name="currentPage" value="${pager.currentPage}"/>
        [#list parameterMap?keys as key]
            [#if parameterMap[key]??]
                <input type="hidden" name="${key}" value="${(parameterMap[key])!''}"/>
            [/#if]
        [/#list]
    </form>
    [/#if]
[/#macro]

